package cn.tqfeiyang.springplus.framework.exception;

import cn.tqfeiyang.springplus.framework.response.ResultCode;

/**
 * 业务异常
 *
 * @author tqfeiyang
 * @date 2018-11-08
 */
public class BusinessException extends RuntimeException {

    private ResultCode resultCode = null;

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(Throwable cause) {
        super(cause);
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
    }

    public BusinessException(String message, ResultCode resultCode) {
        super(message);
        this.resultCode = resultCode;
    }

    public BusinessException(ResultCode resultCode) {
        super(resultCode.getMessage(), null);
        this.resultCode = resultCode;
    }

    public BusinessException(ResultCode resultCode, Throwable cause) {
        super(resultCode.getMessage(), cause);
        this.resultCode = resultCode;
    }

    public BusinessException(ResultCode resultCode, String message) {
        super(message, null);
        this.resultCode = resultCode;
    }

    public ResultCode getResultCode() {
        return resultCode;
    }

}
